﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.orders.Valentines2011 {
    import Modules.achievements.data.*;

    public class ValentineCard {

        private var m_leftID:int;
        private var m_middleID:int;
        private var m_rightID:int;
        private var m_msg:String;
        private var m_seen:Boolean;
        private var m_dataString:String;
        private var m_id:String;
        private var m_sender:String;
        private var m_order:ValentineOrder;

        public function ValentineCard(_arg1:String, _arg2:Boolean, _arg3:String, _arg4:ValentineOrder, _arg5:String){
            this.m_dataString = _arg1;
            var _local6:Array = _arg1.split(",");
            this.m_leftID = int(_local6[0]);
            this.m_middleID = int(_local6[1]);
            this.m_rightID = int(_local6[2]);
            this.m_msg = String(_local6[3]);
            var _local7 = 4;
            while (_local7 < _local6.length) {
                this.m_msg = (this.m_msg + ("," + String(_local6[_local7])));
                _local7++;
            };
            this.m_seen = _arg2;
            this.m_sender = _arg3;
            this.m_order = _arg4;
            this.m_id = _arg5;
        }
        public function get dataString():String{
            return (this.m_dataString);
        }
        public function get leftPart():int{
            return (this.m_leftID);
        }
        public function get middlePart():int{
            return (this.m_middleID);
        }
        public function get rightPart():int{
            return (this.m_rightID);
        }
        public function get message():String{
            return (this.m_msg);
        }
        public function isNew():Boolean{
            return (!(this.m_seen));
        }
        public function get sender():String{
            return (this.m_sender);
        }
        public function setSeen():void{
            if (this.m_order){
                this.m_seen = true;
            };
        }
        public function get id():String{
            return (this.m_id);
        }
        public function set id(_arg1:String):void{
            this.m_id = _arg1;
        }
        public function findMatchingAchievementIcons():Array{
            var ach:* = null;
            var validState:* = false;
            var test:* = null;
            var fn:* = null;
            var params:* = null;
            var achievements:* = Global.achievementsManager.getAchievementGroup("vday_2011").achievements;
            var results:* = [];
            for each (ach in achievements) {
                validState = (((ach.state == Achievement.FINISHED)) || ((ach.state == Achievement.REWARDED)));
                if (!validState){
                } else {
                    test = ach.tests["finish"];
                    if (test != null){
                        fn = String(test.attribute("function"));
                        if (fn == "vdayCheckCardMatch"){
                            params = String(test.attribute("params"));
                            if (this.m_dataString.search(params) >= 0){
                                results.push(ach);
                            };
                        };
                    };
                };
            };
            return (results.map(function (_arg1:Achievement, ... _args):String{
                return (_arg1.iconUrl);
            }));
        }

    }
}//package Classes.orders.Valentines2011 
